<div ng-class="{'fui-navbar':1,'is_backpage':pagedata.is_backpage && main.openbackpage==1}" ng-if="pagedata.nofooter!=1 && pagedata.menus.menus.length>0">
    <a href="javascript:;" ng-repeat="menu in pagedata.menus.menus" ng-click="main.menukey=$index;gotoaction(menu);" ng-class="{'external nav-item':1,'active':main.menukey==$index}">
        <span ng-if="menu.nums>0" class="badge">{{menu.nums}}</span>
		<span ng-if="menu.isimg!=1" class="icon {{menu.icon || 'icon-shouye'}}"></span>
		<span ng-if="menu.isimg==1" class="icon"><img style="width:1.1rem;height:1.1rem;" ng-src="{{tomedia(menu.iconimg)}}"/></span>
		<span class="label">{{menu.title}}</span>
    </a>
</div>
<div ng-class="{'fui-navbar':1,'is_backpage':pagedata.is_backpage && main.openbackpage==1}" ng-if="pagedata.nofooter!=1 && main.menus.length>0 && (!pagedata.menus.menus || pagedata.menus.menus.length==0)">
    <a ng-repeat="item in main.menus" href="javascript:;" ng-click="gotoaction(item);" ng-class="{'external nav-item':1,'active':show_active(item.action)}">
        <span ng-if="item.nums>0" class="badge">{{item.nums}}</span>
		<span ng-if="item.isimg!=1" class="icon {{item.icon || 'icon-shouye'}}"></span>
		<span ng-if="item.isimg==1" class="icon"><img style="width:1.1rem;height:1.1rem;" ng-src="{{tomedia(item.iconimg)}}"/></span>
        <span class="label">{{item.title}}</span>
    </a>
</div>
<script>
scope.pagedata.menus=scope.pagedata.menus?scope.pagedata.menus:{}
if(scope.pagedata.menus && scope.pagedata.menus.menus && scope.pagedata.menus.menus.length>0){
	for(var i=0;i<scope.pagedata.menus.menus.length;i++){
			var action=scope.pagedata.menus.menus[i].url
			if(action && action.indexOf("jy_weishop/member.cart") != -1){
				var key=i;
				scope.get('core/member.login/get_shopcart/',function(res){
					scope.pagedata.cartnums=res.cartnums;
					scope.pagedata.menus.menus[key].nums=scope.pagedata.cartnums
				});
			}
	}
}else if(scope.main.menus && scope.main.menus.length>0){
		for(var i=0;i<scope.main.menus.length;i++){
			var action=scope.main.menus[i].action
			if(action && action.indexOf("jy_weishop/member.cart") != -1){
				var key=i;
				scope.get('core/member.login/get_shopcart/',function(res){
					scope.pagedata.cartnums=res.cartnums;
					scope.main.menus[key].nums=scope.pagedata.cartnums
				});
			}
		}
}
scope.pagedata.getkefuset=function(){
	scope.get('core/welcome/getkefuset/',function(res){
		scope.pagedata.kefuset=res.kefuset;
		scope.$evalAsync();
	});
}
scope.pagedata.getkefuset();
scope.pagedata.tokefu=function(){
	if(scope.pagedata.kefuset.h5appkf==1 && window.config.fromh5wxapp==1 && window.config.container!='ttapp' && window.config.container!='baiduapp'){
		//H5小程序环境下
		var logo=scope.tomedia(scope.pagedata.account.logo);
		var title=scope.pagedata.account.title
		wx.miniProgram.navigateTo({
			url: '/pages/kefu/index?logo='+logo+'&title='+title
		})
	}else{
		if(!scope.pagedata.kefuset.kefutype_h5 || scope.pagedata.kefuset.kefutype_h5==0){
			scope.access_json(scope.pagedata.kefuset.kflink);
		}else if(scope.pagedata.kefuset.kefutype_h5==1){
			scope.pagedata.kefuqr=scope.pagedata.kefuset.kf_accountimg;
			scope.pagedata.showqrcode=1;
		}else if(scope.pagedata.kefuset.kefutype_h5==2){
			scope.access_json(scope.pagedata.kefuset.appkflink)
		}else if(scope.pagedata.kefuset.kefutype_h5==3){
			scope.access_json(scope.pagedata.kefuset.workerh5url)
		}else if(scope.pagedata.kefuset.kefutype_h5==4){
			scope.pagedata.kefuqr=scope.pagedata.kefuset.guwenkfewm;
			scope.pagedata.showqrcode=1
		}
		scope.$evalAsync();
	}
}
scope.gotoaction=function(menu){
	menu.action=menu.action?menu.action:menu.url
	if(menu.type==1){
		location.href= 'tel:'+menu.action
	}else if(menu.type==2){
		wx.scanQRCode({
				needResult: 1, 
				scanType: ["qrCode","barCode"],
				success: function (res) {
					var result = res.resultStr;
					location.href = result;
				}
		});
	}else if(menu.type==3){
		scope.pagedata.tokefu();
	}else{
		scope.access_json(menu.action);
	}
}
</script>